\(\int \sec ^2(e+f x) (a+b \sin ^2(e+f x)) \, dx\) [289]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 18 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=-b x+\frac {(a+b) \tan (e+f x)}{f} \]

[Out]

-b*x+(a+b)*tan(f*x+e)/f

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 18, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3270, 396, 209} \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=\frac {(a+b) \tan (e+f x)}{f}-b x \]

[In]

Int[Sec[e + f*x]^2*(a + b*Sin[e + f*x]^2),x]

[Out]

-(b*x) + ((a + b)*Tan[e + f*x])/f

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 3270

Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = FreeF
actors[Tan[e + f*x], x]}, Dist[ff/f, Subst[Int[(a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(m/2 + p + 1), x], x, T
an[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/2] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {a+(a+b) x^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(a+b) \tan (e+f x)}{f}-\frac {b \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f} \\ & = -b x+\frac {(a+b) \tan (e+f x)}{f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 36, normalized size of antiderivative = 2.00 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=-\frac {b \arctan (\tan (e+f x))}{f}+\frac {a \tan (e+f x)}{f}+\frac {b \tan (e+f x)}{f} \]

[In]

Integrate[Sec[e + f*x]^2*(a + b*Sin[e + f*x]^2),x]

[Out]

-((b*ArcTan[Tan[e + f*x]])/f) + (a*Tan[e + f*x])/f + (b*Tan[e + f*x])/f

Maple [A] (verified)

Time = 0.92 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.67

method result size
derivativedivides \(\frac {\tan \left (f x +e \right ) a +b \left (\tan \left (f x +e \right )-f x -e \right )}{f}\) \(30\)
default \(\frac {\tan \left (f x +e \right ) a +b \left (\tan \left (f x +e \right )-f x -e \right )}{f}\) \(30\)
risch \(-b x +\frac {2 i a}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {2 i b}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}\) \(46\)
parallelrisch \(\frac {-\left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right ) x f b +\left (-2 a -2 b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+f x b}{f \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-f}\) \(59\)
norman \(\frac {b x +b x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-b x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-b x \left (\tan ^{6}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {2 \left (a +b \right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}-\frac {4 \left (a +b \right ) \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}-\frac {2 \left (a +b \right ) \left (\tan ^{5}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}}{\left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )-1\right ) \left (1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )^{2}}\) \(135\)

[In]

int(sec(f*x+e)^2*(a+b*sin(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/f*(tan(f*x+e)*a+b*(tan(f*x+e)-f*x-e))

Fricas [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.94 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=-\frac {b f x \cos \left (f x + e\right ) - {\left (a + b\right )} \sin \left (f x + e\right )}{f \cos \left (f x + e\right )} \]

[In]

integrate(sec(f*x+e)^2*(a+b*sin(f*x+e)^2),x, algorithm="fricas")

[Out]

-(b*f*x*cos(f*x + e) - (a + b)*sin(f*x + e))/(f*cos(f*x + e))

Sympy [F]

\[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=\int \left (a + b \sin ^{2}{\left (e + f x \right )}\right ) \sec ^{2}{\left (e + f x \right )}\, dx \]

[In]

integrate(sec(f*x+e)**2*(a+b*sin(f*x+e)**2),x)

[Out]

Integral((a + b*sin(e + f*x)**2)*sec(e + f*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.37 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.67 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=-\frac {{\left (f x + e - \tan \left (f x + e\right )\right )} b - a \tan \left (f x + e\right )}{f} \]

[In]

integrate(sec(f*x+e)^2*(a+b*sin(f*x+e)^2),x, algorithm="maxima")

[Out]

-((f*x + e - tan(f*x + e))*b - a*tan(f*x + e))/f

Giac [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 31, normalized size of antiderivative = 1.72 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=-\frac {{\left (f x + e\right )} b - a \tan \left (f x + e\right ) - b \tan \left (f x + e\right )}{f} \]

[In]

integrate(sec(f*x+e)^2*(a+b*sin(f*x+e)^2),x, algorithm="giac")

[Out]

-((f*x + e)*b - a*tan(f*x + e) - b*tan(f*x + e))/f

Mupad [B] (verification not implemented)

Time = 13.30 (sec) , antiderivative size = 26, normalized size of antiderivative = 1.44 \[ \int \sec ^2(e+f x) \left (a+b \sin ^2(e+f x)\right ) \, dx=\frac {a\,\mathrm {tan}\left (e+f\,x\right )+b\,\mathrm {tan}\left (e+f\,x\right )-b\,f\,x}{f} \]

[In]

int((a + b*sin(e + f*x)^2)/cos(e + f*x)^2,x)

[Out]

(a*tan(e + f*x) + b*tan(e + f*x) - b*f*x)/f